import React, {FC} from 'react'
import { HashRouter, Switch, Route, Redirect } from "react-router-dom";

 import Login from '../pages/login/index'
// import Index from '../pages/index/index'

const routes: any[] = [
    {
        path: "/login",
        component: Login,
    },
    // {
    //     path: "/index",
    //     component: Index,
    // }
];

const RouteConfig: FC<any> = () => {
    return (
        <HashRouter>
            <Switch>
                {routes.map((route, i) => (
                    <Route
                        key={i}
                        path={route.path}
                        render={props => (
                            <route.component {...props} routes={route.routes} />
                        )}
                    />
                ))}
                {/* 设置默认路由 */}
                <Redirect path="/" exact={true} to="/login/index" />
            </Switch>
        </HashRouter>
    )
}

export default RouteConfig